﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace caufingHealth.Forms
{
    public partial class AdminForm : Form
    {
        Imanager myManager;
        public AdminForm(Imanager manager, Form mdiParent)
        {
            InitializeComponent();
            this.MdiParent = mdiParent;
            myManager = manager;
        }

        private void AdminForm_Load(object sender, EventArgs e)
        {

        }

        private void btn_Submit_Click(object sender, EventArgs e)
        {
            try
            {
                dgv_QueryResults.DataSource = myManager.AdminQuery(txt_Query.Text);
            }
            catch (ArgumentException ex)
            {
                MessageBox.Show(ex.Message + "\nFurther Information:\n" + ex.InnerException.Message, "An error occured", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void btn_Clear_Click(object sender, EventArgs e)
        {
            txt_Query.Text = "";
        }
    }
}
